/*
 * @Author: 王鹏 2911783749@qq.com
 * @Date: 2022-11-08 14:18:35
 * @LastEditors: 王鹏 2911783749@qq.com
 * @LastEditTime: 2022-11-08 15:04:21
 * @FilePath: \vue3Mixiu\code\src\store\index.ts
 * @Description: 
 */
import {defineStore} from 'pinia'  //引入store方法
export const userAuth = defineStore('auth',{
    state:()=>{
        return {user:{}}
    },
    // 也可以这样定义
    // state:()=>({user:{}}),
    getters:{
        getUser:(state)=>{
            state.user
        }
    },
    actions:{
        setUser(value:any){
            if(value){
                this.user=value
            }else{
                this.user={}
            }
        }
    }
})